Add relocatable installs to support concurrency-safe cached environments #5509
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The idea here is similar to what we do for wheels: we create the
CachedEnvironment
in thearchive-v0
bucket, then symlink it to its content-addressed location. This ensures that we can always recreate these environments without concern for whether anyone else is accessing them.Part of the challenge here is that we want the virtual environments to be relocatable, because we're now building them in one location but persisting them in another. This requires that we write relative (rather than absolute) paths to scripts and entrypoints. The main risk with relocatable virtual environments is that the scripts and entrypoints themselves are not relocatable, because they use a relative shebang. But that's fine for cached environments, which are never intended to leave the cache.
Closes #5503.